package com.example.personal.aiagent.common.exception;

import com.example.personal.aiagent.common.constant.ErrorCode;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 自定义服务异常
 */
@Setter
@Getter
public class CustomServiceException extends RuntimeException {
    private ErrorCode errorCode = ErrorCode.SYSTEM_ERROR;

    private List<String> params = new ArrayList<>();

    public CustomServiceException(String message) {
        super(message);
    }

    public CustomServiceException(ErrorCode errorCode) {
        super(errorCode.getErrorMessage());
        this.errorCode = errorCode;
    }

    public CustomServiceException(ErrorCode errorCode, List<String> params) {
        super(errorCode.getErrorMessage());
        this.errorCode = errorCode;
        this.params = params;
    }

    public CustomServiceException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public CustomServiceException(String message, Throwable throwable, ErrorCode errorCode) {
        super(message, throwable);
        this.errorCode = errorCode;
    }

    public CustomServiceException(String message, Throwable throwable, ErrorCode errorCode, List<String> params) {
        super(message, throwable);
        this.errorCode = errorCode;
        this.params = params;
    }
}
